package com.huawei.appmarket.service.store.awk.card;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import com.huawei.appgallery.foundation.card.base.card.BaseDistCard;
import com.huawei.appgallery.foundation.service.common.protocol.AppDetailActivityProtocol;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appmarket.framework.AppDetailActivity;
import com.huawei.appmarket.service.store.awk.bean.SubstanceAudioCardBean;
import com.huawei.appmarket.support.audio.AudioBean;
import com.huawei.appmarket.support.audio.AudioPlayerView;
import o.cgz;
import o.cjj;
import o.dgm;
import o.epe;
import o.ewm.j;

public class SubstanceAudioCard extends BaseDistCard {
    private String ʼ;
    private String ʽ;
    private AudioPlayerView ˋ;
    private int ᐝ;

    public SubstanceAudioCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        this.ˋ = (AudioPlayerView) view.findViewById(j.ˋᕀ);
        this.ᐝ = dgm.ˎ((Activity) this.ʼॱ);
        ˋ();
        ʽ(view);
        return this;
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (cardBean instanceof SubstanceAudioCardBean) {
            SubstanceAudioCardBean substanceAudioCardBean = (SubstanceAudioCardBean) cardBean;
            if (this.ˋ != null) {
                String ꜞ = substanceAudioCardBean.ꜞ();
                String ʽ = substanceAudioCardBean.ʽ();
                int ॱ = substanceAudioCardBean.ॱ();
                AudioBean ˋ = epe.ˏ().ˋ(ꜞ, this.ᐝ, this.ʼ, ʽ);
                ˋ.ʻ(substanceAudioCardBean.ㆍ());
                if (ˋ.ᐝ() <= 0) {
                    ˋ.ॱ(ॱ);
                }
                ˋ.ˊ(this.ʽ);
                ˋ.ॱ(substanceAudioCardBean.ˊ());
                this.ˋ.setData(ˋ);
                this.ˋ.ˊ();
            }
        }
    }

    public void ˋ() {
        if (this.ʼॱ instanceof AppDetailActivity) {
            AppDetailActivityProtocol appDetailActivityProtocol = (AppDetailActivityProtocol) cjj.ˊ((AppDetailActivity) this.ʼॱ).ˏ();
            if (appDetailActivityProtocol != null && appDetailActivityProtocol.ॱ() != null) {
                this.ʼ = appDetailActivityProtocol.ॱ().ॱ();
                this.ʽ = appDetailActivityProtocol.ॱ().ˎ();
            }
        }
    }
}
